#include <cstdio>
#include <iostream>
using namespace std;

int a[1005][1005];
int cr[1005][1005];
int rc[1005][1005];
int n, m;
int q;
int temp;
int main()
{
    int r1, c1, r2, c2, h, w;
    cin >> n >> m >> q;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            scanf("%d", &a[i][j]);
    while (q--)
    {
        scanf("%d %d %d %d %d %d", &r1, &c1, &r2, &c2, &h, &w);
        int o = r2 - r1;
        int p = c2 - c1;
        for (int i = r1; i < r1 + h ; i++)
        {
            for (int j = c1; j < c1 + w ; j++)
            {
                temp = a[i][j];
                a[i][j] = a[i + o][j + p];
                a[i + o][j + p] = temp;
            }
        }
    }
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
            cout << a[i][j] << " ";
        cout << endl;
    }
    return 0;
}